﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.LoadedPmiTypes.CUiLoadedPmiTypesCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using COMMANDPARAMSLib;
using System.Collections.Generic;
using System.Windows.Forms;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.LoadedPmiTypes;

[Tx3DPlanningCommandCategory]
public class CUiLoadedPmiTypesCmd : TxButtonCommand
{
  public virtual void Execute(object cmdParams)
  {
    Cursor current = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
    if (!(cmdParams is CoLoadedPmiTypesParams loadedPmiTypesParams))
      return;
    List<TxPmiType> pmiTypesFromString = TxPmiType.GetPmiTypesFromString(((ICoLoadedPmiTypesParams) loadedPmiTypesParams).ExcludedTypes);
    try
    {
      CUiLoadedPmiTypesForm loadedPmiTypesForm = new CUiLoadedPmiTypesForm(pmiTypesFromString);
      if (((Form) loadedPmiTypesForm).ShowDialog() != DialogResult.OK)
        return;
      string pmiTypesAsString = TxPmiType.GetPmiTypesAsString(loadedPmiTypesForm.ExcludedTypes);
      ((ICoLoadedPmiTypesParams) loadedPmiTypesParams).ExcludedTypes = pmiTypesAsString;
    }
    finally
    {
      Cursor.Current = current;
    }
  }

  public virtual string Category => StringTable.LOADED_PMI_TYPES_CATEGORY;

  public virtual string Name => StringTable.LOADED_PMI_TYPES_NAME;

  public virtual string Description => StringTable.LOADED_PMI_TYPES_DESCRIPTION;

  public virtual string Tooltip => StringTable.LOADED_PMI_TYPES_TOOLTIP;

  public virtual ITxCommandEnabler CommandEnabler
  {
    get => (ITxCommandEnabler) new TxCommandEnabler(false);
  }

  public virtual bool Connect() => true;

  public virtual void Disconnect()
  {
  }
}
